<template>
  <!-- 原本作为气象站配置，现在只是作为一个模板 -->
  <BaseMainSlot>
    <template v-slot:zhactbar>
      <ActionBar
        :add-active="addActive"
        :del-active="delActive"
        :edit-active="editActive"
        :cancel-active="cancelActive"
        :save-active="saveActive"
        @add="add"
        @cancel="cancel"
        @edit="edit"
        @del="del"
        @save="save"
      />
    </template>
    <template v-slot:content>
      <el-table
        v-loading="loading"
        highlight-current-row
        :data="tableData"
        stripe
        border
        height="calc(100% - 50px)"
        @row-click="handleEdit"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column type="index" label="序号" width="100" />
        <el-table-column prop="unitName" label="采集名称" />
        <el-table-column prop="symbol" label="采集地址" />
      </el-table>
      <Pagination
        :page-size="pageSize"
        :current-page="currentPage"
        :total-size="totalSize"
        @changePageSize="changePageSize"
        @changeCurrentPage="changeCurrentPage"
      />
      <el-dialog
        title="气象地址添加"
        :visible.sync="isshowdiaview"
        width="40%"
      >
        <div class="zh-dialog-content">
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button type="success" @click="isshowdiaview = false">取消</el-button>
          <el-button type="primary">确认</el-button>
        </span>
      </el-dialog>
    </template>
  </BaseMainSlot>
</template>
<script>
import ActionBar from "@/components/ActionBar";
import Pagination from "@/components/Pagination";
import nowpagereq from "@/api/basic-info-manage/unit-manage";
import BaseMainSlot from "@/components/BaseMainSlot/baseone.vue"
import { mymixin } from "@/utils/mixin"
export default {
  name: "MetedataCollManage",
  components: { ActionBar, Pagination, BaseMainSlot },
  mixins: [mymixin],
  data() {
    return {
      // 是否展示弹窗
      isshowdiaview: true,
      selectidlist: []
    }
  },
  watch: {},
  created() {
    // 获取表格数据
    this.getTableDataList();
  },
  mounted() {},
  methods: {
    getTableDataList() {
      this.loading = true;
      let params = {
        page: this.currentPage,
        size: this.pageSize,
        unitName: this.unitName
      }
      nowpagereq.getPlantingUnitListByCondition(params).then(res => {
        console.log(res.data)
      })
    },
    delmessage() {
      this.selectidlist = []
      nowpagereq.addPlantingUnitInfo()
    },
    save() {
      if (this.nowChanceStau === 'edit') {
        console.log("edit")
      }
    },
    // 表格选择
    handleSelectionChange(list) {
      this.selectedPlantingUnitList = [];
    //   this.selectedPlantingUnitList = list.map(item => {
    //     if (item.unitId) {
    //       return item.unitId
    //     } else {
    //       notvalue = false
    //       return ""
    //     }
    //   })
    },
    // 表格选中
    handleEdit(row) {
      if (row.unitId) {
        this.formData = row;
        this.editActive = true;
        this.saveActive = false;
        this.cancelActive = true;
        this.canInput = false;
      }
    }
  },
  // 页数与页码选择
  changePageSize(pageSize) {
    this.pageSize = pageSize;
    this.getTableDataList();
  },
  changeCurrentPage(currentPage) {
    this.currentPage = currentPage;
    this.getTableDataList();
  }
}
</script>
<style lang="scss" scoped>
.zh-dialog-content{
    width: 100%;
    height: 200px;
    background-color: rgb(240, 26, 26);
}
</style>
